package com.wasu.entity.live;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * <p>------------------------------------------------------
 * <p>Copyright (C) 2020 wasu company, All rights reserved.
 * <p>------------------------------------------------------
 * <p> 保存频道所有信息，包含IPTV和DVB频点信息
 * <p>
 *
 * @author Created by zhangmz
 * @date on 2023/8/1
 */
public class WasuChInfor implements Parcelable {

    /**mak
     * 频道ID
     */
    private String chId;
    /**
     * 频道代码
     */
    private String chCode;
    /**
     * 频道号
     */
    private int chNo;
    /**
     * 频道名称
     */
    private String chName;
    /**
     * 频道英文名称
     */
    private String chEnName;
    /**
     * 频道其他名称(JSON)
     */
    private String chOtrName;
    /**
     * 频道类型：0-IP类型
     */
    private int Type;
    /**
     * 频道所属，4境外频道
     */
    private String channelDir;
    /**
     * 播放类型：2-IP播放
     */
    private String playtype;
    /**
     * 频道台标地址
     */
    private String chLogoURL;
    /**
     * 是否有对应高清频道：0-无；1-有，默认为0
     */
    private String isHdCh;
    /**
     * 高清频道Id（标清频道对应的高清频道Id）
     */
    private String hdChId;
    /**
     * 高清频道号（标清频道对应的高清频道号）
     */
    private String hdChNo;
    /**
     * 是否授权：0-否；1-是，默认为1
     */
    private String isAuth;

    /**
     * 直播类型：1-IP直播；2-DVB直播，默认为1
     */
    private String liveType;
    /**
     * 频道描述
     */
    private String desc;

    /**
     * IP直播
     */
    private WasuIpLiveUrl ipLive;

    /**
     * dvb直播
     */
    private WasuDvbLiveUrl dvbLive;

    /****************************** 以下变量，是播控业务所需，非接口响应 ***************************/
    /**
     * 保存当前频道正在播放节目单
     * UI层有业务需要
     */
    private WasuEdit program;

    /**
     * DVB模式下频道是否授权
     */
    private String isPurchased;

    /**
     * 是否支持时移/回放
     * 该字段不是服务端返回字段，由终端自己定义
     * 值是由4K网关和是否包含回放地址决定
     */
    private boolean isBackThroughAuth = false;

    public WasuChInfor(){

    }

    public WasuChInfor(String chId, String chCode, int chNo, String chName, String chEnName, String chOtrName, int type, String channelDir, String playtype, String chLogoURL, String isHdCh, String hdChId, String hdChNo, String isAuth, String liveType, String desc, WasuIpLiveUrl ipLive, WasuDvbLiveUrl dvbLive, WasuEdit program, String isPurchased, boolean isBackThroughAuth) {
        this.chId = chId;
        this.chCode = chCode;
        this.chNo = chNo;
        this.chName = chName;
        this.chEnName = chEnName;
        this.chOtrName = chOtrName;
        Type = type;
        this.channelDir = channelDir;
        this.playtype = playtype;
        this.chLogoURL = chLogoURL;
        this.isHdCh = isHdCh;
        this.hdChId = hdChId;
        this.hdChNo = hdChNo;
        this.isAuth = isAuth;
        this.liveType = liveType;
        this.desc = desc;
        this.ipLive = ipLive;
        this.dvbLive = dvbLive;
        this.program = program;
        this.isPurchased = isPurchased;
        this.isBackThroughAuth = isBackThroughAuth;
    }

    protected WasuChInfor(Parcel in) {
        chId = in.readString();
        chCode = in.readString();
        chNo = in.readInt();
        chName = in.readString();
        chEnName = in.readString();
        chOtrName = in.readString();
        Type = in.readInt();
        channelDir = in.readString();
        playtype = in.readString();
        chLogoURL = in.readString();
        isHdCh = in.readString();
        hdChId = in.readString();
        hdChNo = in.readString();
        isAuth = in.readString();
        liveType = in.readString();
        desc = in.readString();
        ipLive = in.readParcelable(WasuIpLiveUrl.class.getClassLoader());
        dvbLive = in.readParcelable(WasuDvbLiveUrl.class.getClassLoader());
        program = in.readParcelable(WasuEdit.class.getClassLoader());
        isPurchased = in.readString();
        isBackThroughAuth = in.readByte() != 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(chId);
        dest.writeString(chCode);
        dest.writeInt(chNo);
        dest.writeString(chName);
        dest.writeString(chEnName);
        dest.writeString(chOtrName);
        dest.writeInt(Type);
        dest.writeString(channelDir);
        dest.writeString(playtype);
        dest.writeString(chLogoURL);
        dest.writeString(isHdCh);
        dest.writeString(hdChId);
        dest.writeString(hdChNo);
        dest.writeString(isAuth);
        dest.writeString(liveType);
        dest.writeString(desc);
        dest.writeParcelable(ipLive, flags);
        dest.writeParcelable(dvbLive, flags);
        dest.writeParcelable(program, flags);
        dest.writeString(isPurchased);
        dest.writeByte((byte) (isBackThroughAuth ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<WasuChInfor> CREATOR = new Creator<WasuChInfor>() {
        @Override
        public WasuChInfor createFromParcel(Parcel in) {
            return new WasuChInfor(in);
        }

        @Override
        public WasuChInfor[] newArray(int size) {
            return new WasuChInfor[size];
        }
    };

    public String getChId() {
        return chId;
    }

    public void setChId(String chId) {
        this.chId = chId;
    }

    public String getChCode() {
        return chCode;
    }

    public void setChCode(String chCode) {
        this.chCode = chCode;
    }

    public int getChNo() {
        return chNo;
    }

    public void setChNo(int chNo) {
        this.chNo = chNo;
    }

    public String getChName() {
        return chName;
    }

    public void setChName(String chName) {
        this.chName = chName;
    }

    public String getChEnName() {
        return chEnName;
    }

    public void setChEnName(String chEnName) {
        this.chEnName = chEnName;
    }

    public String getChOtrName() {
        return chOtrName;
    }

    public void setChOtrName(String chOtrName) {
        this.chOtrName = chOtrName;
    }

    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    public String getChannelDir() {
        return channelDir;
    }

    public void setChannelDir(String channelDir) {
        this.channelDir = channelDir;
    }

    public String getPlaytype() {
        return playtype;
    }

    public void setPlaytype(String playtype) {
        this.playtype = playtype;
    }

    public String getChLogoURL() {
        return chLogoURL;
    }

    public void setChLogoURL(String chLogoURL) {
        this.chLogoURL = chLogoURL;
    }

    public String getIsHdCh() {
        return isHdCh;
    }

    public void setIsHdCh(String isHdCh) {
        this.isHdCh = isHdCh;
    }

    public String getHdChId() {
        return hdChId;
    }

    public void setHdChId(String hdChId) {
        this.hdChId = hdChId;
    }

    public String getHdChNo() {
        return hdChNo;
    }

    public void setHdChNo(String hdChNo) {
        this.hdChNo = hdChNo;
    }

    public String getIsAuth() {
        return isAuth;
    }

    public void setIsAuth(String isAuth) {
        this.isAuth = isAuth;
    }

    public String getIsPurchased() {
        return isPurchased;
    }

    public void setIsPurchased(String isPurchased) {
        this.isPurchased = isPurchased;
    }

    public String getLiveType() {
        return liveType;
    }

    public void setLiveType(String liveType) {
        this.liveType = liveType;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public WasuIpLiveUrl getIpLive() {
        return ipLive;
    }

    public void setIpLive(WasuIpLiveUrl ipLive) {
        this.ipLive = ipLive;
    }

    public WasuDvbLiveUrl getDvbLive() {
        return dvbLive;
    }

    public void setDvbLive(WasuDvbLiveUrl dvbLive) {
        this.dvbLive = dvbLive;
    }

    public WasuEdit getProgram() {
        return program;
    }

    public void setProgram(WasuEdit program) {
        this.program = program;
    }

    public boolean isBackThroughAuth() {
        return isBackThroughAuth;
    }

    public void setBackThroughAuth(boolean backThroughAuth) {
        isBackThroughAuth = backThroughAuth;
    }

    @Override
    public String toString() {
        return "WasuChInfor{" +
                "chId='" + chId + '\'' +
                ", chCode='" + chCode + '\'' +
                ", chNo=" + chNo +
                ", chName='" + chName + '\'' +
                ", chEnName='" + chEnName + '\'' +
                ", chOtrName='" + chOtrName + '\'' +
                ", Type=" + Type +
                ", channelDir='" + channelDir + '\'' +
                ", playtype='" + playtype + '\'' +
                ", chLogoURL='" + chLogoURL + '\'' +
                ", isHdCh='" + isHdCh + '\'' +
                ", hdChId='" + hdChId + '\'' +
                ", hdChNo='" + hdChNo + '\'' +
                ", isAuth='" + isAuth + '\'' +
                ", liveType='" + liveType + '\'' +
                ", desc='" + desc + '\'' +
                ", ipLive=" + ipLive +
                ", dvbLive=" + dvbLive +
                ", program=" + program +
                ", isPurchased='" + isPurchased + '\'' +
                ", isBackThroughAuth=" + isBackThroughAuth +
                '}';
    }
}
